package com.tsd.jxc.sale.vo;

import com.tsd.core.utils.DoubleUtil;
import com.tsd.core.utils.HlpUtils;

import java.math.BigDecimal;

/**
 * @ClassName: JxcSaleContractDetailVo
 * @Description: TODO
 * @Author: Hillpool
 * @Date: 2023/3/7 15:48
 * @Version: 1.0
 */
public class JxcSaleContractDetailVo {

    private Integer _index;

    private String client_code;

    private String board;

    private BigDecimal board_thick;

    private String layer_num;

    private String surface_deal;

    private String solder_color;

    private String silk_screen_color;

    private BigDecimal size_length;

    private BigDecimal size_width;

    private BigDecimal make_up;

    private BigDecimal qty;

    private BigDecimal price;

    private BigDecimal amount;

    private String unit;

    private BigDecimal engineering_fee;

    private BigDecimal test_frame_fee;

    private BigDecimal flight_test_fee;

    private String note_info;

    public Integer get_index() {
        return _index;
    }

    public void set_index(Integer _index) {
        this._index = _index;
    }

    public String getClient_code() {
        return client_code;
    }

    public void setClient_code(String client_code) {
        this.client_code = client_code;
    }

    public String getBoard() {
        return board;
    }

    public void setBoard(String board) {
        this.board = board;
    }

    public BigDecimal getBoard_thick() {
        return board_thick;
    }

    public void setBoard_thick(BigDecimal board_thick) {
        this.board_thick = board_thick;
    }

    public String getLayer_num() {
        return layer_num;
    }

    public void setLayer_num(String layer_num) {
        this.layer_num = layer_num;
    }

    public String getSurface_deal() {
        return surface_deal;
    }

    public void setSurface_deal(String surface_deal) {
        this.surface_deal = surface_deal;
    }

    public String getSolder_color() {
        return solder_color;
    }

    public void setSolder_color(String solder_color) {
        this.solder_color = solder_color;
    }

    public String getSilk_screen_color() {
        return silk_screen_color;
    }

    public void setSilk_screen_color(String silk_screen_color) {
        this.silk_screen_color = silk_screen_color;
    }

    public BigDecimal getSize_length() {
        return size_length;
    }

    public void setSize_length(BigDecimal size_length) {
        this.size_length = size_length;
    }

    public BigDecimal getSize_width() {
        return size_width;
    }

    public void setSize_width(BigDecimal size_width) {
        this.size_width = size_width;
    }

    public BigDecimal getMake_up() {
        return make_up;
    }

    public void setMake_up(BigDecimal make_up) {
        this.make_up = make_up;
    }

    public BigDecimal getQty() {
        return qty;
    }

    public void setQty(BigDecimal qty) {
        this.qty = qty;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public BigDecimal getEngineering_fee() {
        return engineering_fee;
    }

    public void setEngineering_fee(BigDecimal engineering_fee) {
        this.engineering_fee = engineering_fee;
    }

    public BigDecimal getTest_frame_fee() {
        return test_frame_fee;
    }

    public void setTest_frame_fee(BigDecimal test_frame_fee) {
        this.test_frame_fee = test_frame_fee;
    }

    public BigDecimal getFlight_test_fee() {
        return flight_test_fee;
    }

    public void setFlight_test_fee(BigDecimal flight_test_fee) {
        this.flight_test_fee = flight_test_fee;
    }

    public String getNote_info() {
        return note_info;
    }

    public void setNote_info(String note_info) {
        this.note_info = note_info;
    }

    public String getSize_str() {
        String length = HlpUtils.isEmpty(this.getSize_length()) ? "0" : this.getSize_length().stripTrailingZeros().toPlainString();
        String width = HlpUtils.isEmpty(this.getSize_width()) ? "0" : this.getSize_width().stripTrailingZeros().toPlainString();
        String makeUp = HlpUtils.isEmpty(this.getMake_up()) ? "0" : this.getMake_up().stripTrailingZeros().toPlainString();
        return String.format("%s*%s/%s", length, width, makeUp);
    }

    public BigDecimal getTotal_amount() {
        double totalAmount = 0D;
        if (HlpUtils.isEmpty(this.getAmount())) {
            totalAmount = DoubleUtil.mul(this.getPrice(), this.getQty());
        } else {
            totalAmount = this.getAmount().doubleValue();
        }
        totalAmount = DoubleUtil.add(totalAmount, this.getEngineering_fee());
        totalAmount = DoubleUtil.add(totalAmount, this.getTest_frame_fee());
        totalAmount = DoubleUtil.add(totalAmount, this.getFlight_test_fee());
        return BigDecimal.valueOf(totalAmount);
    }

}
